package com.beta.em.order;

import java.util.Objects;

/**
 * Created by lichao on 2016/11/24.
 */
public enum OrderItemStatus {

    REJECTED("rejected", "已拒收"),
    ACCEPTED("accepted", "取消拒收");

    private String value;
    private String cnValue;

    public String getValue() {
        return value;
    }

    public String getCnValue() {
        return cnValue;
    }

    OrderItemStatus(String value, String cnValue) {
        this.value = value;
        this.cnValue = cnValue;
    }

    public static OrderItemStatus getOrderItemStatus(String value) {
        for (OrderItemStatus orderItemStatus : values()) {
            if (orderItemStatus.getValue().equals(value)) {
                return orderItemStatus;
            }
        }
        return null;
    }

    public static String getCnValue(String value) {
        OrderItemStatus orderItemStatus = getOrderItemStatus(value);
        if (Objects.nonNull(orderItemStatus)) {
            return orderItemStatus.getCnValue();
        }
        return "";
    }

}

